package enums.http;

import java.util.ArrayList;
import java.util.List;

/**
 * 响应码枚举类
 * 
 * @author zhanyh
 *
 * @date 2018年10月16日
 */
public enum ResponseCodeEnum {
	SUCCESS("10000", "成功"),
	
	MESSAGE_SUCCESS("100000", "成功"),//成功并且需要给出提示

	PARAM_ERROR("10001", "参数错误"),

	LOGON_INVALIED("10002", "登录失效，请重新登录"),

	NU_LOGIN("10003", "登录失效，请重新登录"),

	LOGIN_ELSEWHERE("10004", "您的账号于{0}在其他设备登录，若非本人操作，请及时修改密码"),

	LOGIN_EXPIRES("10005", "登录过期"),

	URL_ILLEGAL("10006", "路径非法"),

	USER_NOTEXTIES("10007", "账号有误,请检查"),

	PASSWORD_ERROR("10008", "密码有误,请检查"),

	MAX_PWD_ERROR_NUM("10009", "密码错误次数过多，请1小时后重新登录"),

	CONFIG_ERROR("10010", "配置错误"),

	NEWPWD_NOTEQUAL_REP("10011", "新密码与重新输入新密码不一致"),

	USER_NOT_EXTIES("10012", "用户不存在"),

	USER_ACTIVED("10013", "用户已经激活"),

	CHECK_CODE_FIRST("10014", "请先发送验证码"),

	DATABASE_OPERATION_ERROR("10014", "数据库操作失败"),

	CHECK_CODE_ERROR("10015", "验证码错误"),

	PHONE_MISMATCH("10016", "非当前用户绑定手机号码"),

	FREQUENT_OPERATION("10017", "操作过于频繁请稍后再试"), PWD_ERROR("10018", "原始密码错误"),

	ACCOUNT_EXIST("10019", "已有用户绑定该手机号码"),

	DATA_RECORD_NOTEXTIES("10020", "数据库记录不存在"),

	JOB_EXTIES("10021", "工号已经存在"),

	SIGN_ERROR("10022", "签名异常"),

	DEPT_NO_EXTIES("10023", "部门不存在"),

	JOB_NO_EXTIES("10024", "岗位不存在"),

	BORROWER_NO_EXTIES("10025", "借方不存在"),

	CAPITAL_NO_EXTIES("10026", "资方不存在"),

	CARD_EXTIES("10027", "已有用户绑定该身份证件号码"),

	CAPITAL_AUTHED("10028", "资方修改已经处理"),

	CAP_TYPE_NOT_EXTIST("10029", "资方类型不存在"),

	PROCESS_NOT_EXTIST("10030", "流程不存在"),

	PRODUCT_EXTIST("10031", "产品已经存在"),

	PRODUCT_NOT_EXTIST("10032", "产品不经存在"),

	FILE_COUNT_MISSMATCH("10034", "文件数量不匹配"),

	FILE_USED("10035", "文件已经被使用"),

	IDCARD_ERROR("10037", "身份证格式错误"),

	NO_PREMISSION("10038", "无权限"),

	STATUS_ERROR("10036", "当前订单状态已经发生改变，请关闭页面后刷新列表进行查看"),

	USER_NOT_ACTIVE("10039", "初始密码为123456"),

	DATA_CHANGED("10040", "数据已被他人更改,请刷新页面重试"),

	USER_UNACTIVER("10041", "当前账户未激活,初始密码为123456"),

	USER_CLIENT_ERROR("10042", "非{0}可登录账户"),

	USER_MODIFIED("10043", "用户信息已修改，请重新登录"),

	HAS_CHILDREN_PERMISSION("10044", "当前权限点下有子权限点"),
	
	UN_GET_MENU_PERMISSION("10045", "请先获取菜单权限"),

	UN_EDIT_COMMISSION_FEE("10046", "财务已审核通过，中介费模块修改无效，金额已复原，请核对后再提交！"),

	UN_BACK_EDIT_COMMISSION_FEE("10047", "业务员已更新金额，请重新审核！"),

	WEI_CHAT_DEPT_USER("10048", "微信更换部门失败"),

	WEI_CHAT_DEPT("10049", "微信获取部门失败"),
	
	NOT_SUPPORT_USER("10050", "非系统可登录账号"),

	WEI_CHAT_SYN_USER("10051", "同步人员失败"),

	WEI_CHAT_SYN_DEPT("10052", "同步部门失败"),

	WEI_CHAT_SYN("10053", "该部门下有子部门或在职人员账号，无法停用！请先停用子部门或将该部门下的人员都设置为离职！"),
	
	COMMISSION_STAGE("10054", "当前订单已进入分佣阶段,无法提交{0}款"),
	
	DATA_ERROR("10056", "数据错误"),

	PENGING_COMMISSION_ERROR("10060", "当前订单有未完结的放款/回款/退款\n无法提交分佣\n请先完结后再提交分佣"),

	TOTAL_COMMISSION_ERROR("10061", "金额总和有误\n合计需等于回款金额之和，请检查"),

	TOTAL_CHANGE_COMMISSION_ERROR("10062", "金额发生改变\n订单金额发生改变，请刷新后重试"),
	
	JIGUANG_PUSH_FALI("10063", "激光推送失败"),
	
	JIGUANG_PUSH_ERROE("10064", "激光推送异常"),
	
	STATUS_ERROR_LOAN("10065", "当前订单有未完结的回款/退款/无法申请终止请先完结后再申请终止"),

	SYSTEM_MAINTENANCE("66666", "系统维护中,请稍后再试。。。"),
	
	JSON_PARAM_ERROR("99999", "json参数异常"),

	CALL_BACK_ERROR("77777", "上上签回调异常"),

	SYSTEM_ERROR("99999", "系统异常");

	private String code;
	private String message;

	private ResponseCodeEnum(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	// 根据code获取枚举
	public static ResponseCodeEnum getEnumByCode(String code) {
		if (code == null || code == "") {
			return null;
		}
		for (ResponseCodeEnum temp : ResponseCodeEnum.values()) {
			if (temp.getCode().equals(code)) {
				return temp;
			}
		}
		return null;
	}

	public static List<String> getCodes() {
		List<String> li = new ArrayList();
		for (ResponseCodeEnum temp : ResponseCodeEnum.values()) {
			li.add(temp.getCode());
		}
		return li;
	}
}
